package com.cesgroup.zw.spring.boot.library.echarts.pie.complex;

import com.cesgroup.zw.spring.boot.echarts.component.Dataset;
import com.cesgroup.zw.spring.boot.echarts.component.Tooltip;
import com.cesgroup.zw.spring.boot.echarts.component.series.Pie;
import com.cesgroup.zw.spring.boot.echarts.enums.Position;
import com.cesgroup.zw.spring.boot.echarts.model.data.SankeyData;
import com.cesgroup.zw.spring.boot.echarts.model.series.Emphasis;
import com.cesgroup.zw.spring.boot.echarts.model.series.LabelLine;
import com.cesgroup.zw.spring.boot.echarts.model.style.ItemStyle;
import com.cesgroup.zw.spring.boot.echarts.model.style.LabelStyle;

/**
 * @author ytj
 * @date 2019/7/4 15:11
 */
@SuppressWarnings("serial")
public class ComplexPieSeries extends Pie {
    public ComplexPieSeries(ComplexPieParam param){
        this.setRadius(new String[]{"30%", "61%"});
        this.setCenter(new String[]{"50%", "50%"});
        this.setType("pie");
        this.setLabel(new LabelStyle(){{
            this.setShow(true);
            this.setFormatter("{c}%");
            this.setFontSize(30);
            this.setPosition(Position.outside);
        }});
        this.setLabelLine(new LabelLine(){{
            this.setShow(true);
            this.setLength(30);
            this.setLength2(55);
        }});
        this.setData(param.getDataset());
        this.setName("民警训练总量");
    }
    public ComplexPieSeries(){
        this.setRadius(new String[]{"30%", "34%"});
        this.setCenter(new String[]{"50%", "50%"});
        this.setType("pie");
        this.setLabel(new LabelStyle(){{
            this.setShow(false);
        }});
        this.setLabelLine(new LabelLine(){{
            this.setShow(false);
        }});
        this.setAnimation(false);
        this.setTooltip(new Tooltip(){{
            this.setShow(false);
        }});
        this.setData(new Object[]{new SankeyData(){{
            this.setValue(1);
            this.setItemStyle(new ItemStyle(){{
                this.setColor("rgba(250,250,250,0.3)");
            }});
        }}});
    }
    public ComplexPieSeries(String param){
        this.setName("外边框");
        this.setType("pie");
        this.setClockwise(false);
        this.setHoverAnimation(false);
        this.setCenter(new String[]{"50%", "50%"});
        this.setRadius(new String[]{"65%", "65%"});
        this.setLabel(new LabelStyle(){{
            this.setShow(false);
        }});
        this.setData(new Object[]{new SankeyData(){{
            this.setValue(9);
            this.setName("");
            this.setItemStyle(new ItemStyle(){{
                this.setBorderWidth(2);
                this.setBorderColor("#0b5263");
            }});
        }}});
    }
}
